using UnityEngine;
using System.Collections;
using System.Collections.Generic;
	
public enum GameStatus
{
    Start,//Phase Host / Join 
    Lobby,//Lancer jeu (chat)
	Game //La partie commence !!!
}

[RequireComponent(typeof(NetworkView))]
public class GameManager : MonoBehaviour
{

    public bool isDebugFightingScene=false;
    public Networking networkManager;
    public string playerName = "PlayerName";
	
	//GameMenu
	public GameMenus gamemenu;
	
	//Hud
	public Hud hud;
	
	//Dark Arena Data
	public DarkArena darkArena;

    public GameStatus gameStatus = GameStatus.Start;

    //Game Settings
    //TODO : une classe pour stocker tout ça ?
    public string gameName;

    public void Awake()
    {
        DontDestroyOnLoad(gameObject);
        //init values
        gameStatus = GameStatus.Start;
    }
	
	public void Start()
    {
        //-------------------------------- TEST -----------------------------
		if (isDebugFightingScene)
		{
		gamemenu.OnPlayersReady();
		gameStatus = GameStatus.Game;
		StartFightScene();
		}
    }

    public void Update()
    {

    }

    //call on the server to start the game
    public void LaunchGame()
    {
        networkManager.serverStatus = ServerStatus.InGame;
		darkArena.Clean();
        Network.maxConnections = -1;
        gameStatus = GameStatus.Lobby;
        //remove all chat RPC
        Network.RemoveRPCsInGroup(1);
    }
	
    public void StartSelectClass()
    {
        gameStatus = GameStatus.Game;
		gamemenu.OnPlayersReady();
		hud.InitializeSelectClassScene();
		darkArena.darkArenaStatus = DarkArenaStatus.SelectClass;
    }
	
    public void StartSelectSpells()
    {
		hud.QuitSelectClassScene();
		hud.InitializeSelectSpells();
		darkArena.darkArenaStatus = DarkArenaStatus.SelectSpell;
    }
	
	public void StartFightScene()
    {
		hud.QuitSelectSpellsScene();
		darkArena.darkArenaStatus = DarkArenaStatus.Fight;
		hud.InitializeFightingScene();
    }
    
}
